import Cookies from "js-cookie";
import {ref} from "vue";

const TokenKey = 'TokenKey_token_Library'

export function getToken() {
    return Cookies.get(TokenKey)
}

export function setToken(token: string) {
    return Cookies.set(TokenKey, token)
}

export function removeToken() {
    return Cookies.remove(TokenKey)
}

const RefreshKey = 'RefreshKey_token_Library'

export function getRefreshToken() {
    return Cookies.get(RefreshKey)
}

export function setRefreshToken(refreshToken: string) {
    return Cookies.set(RefreshKey, refreshToken)
}

export function removeRefreshToken() {
    return Cookies.remove(RefreshKey)
}


const RoleKey = 'RoleKey'

export function getRole() {
    return Cookies.get(RoleKey)
}

export function setRole(role: string) {
    return Cookies.set(RoleKey, role)
}

export function removeRole() {
    return Cookies.remove(RoleKey)
}

export function getStatusText(status:string) {
    console.log(status)
    // You can customize this method to display meaningful status text
    switch (status.toString()) {////订单状态 1已付款，2已出餐待派送，3已接单，4已派送，5已完成，6已取消
        case '1':
            return '已付款';
        case '2':
            return '待派送';
        case '3':
            return '已接单';
        case '4':
            return '已派送';
        case '5':
            return '已完成';
        case '6':
            return '已取消';
        default:
            return '未知状态';
    }
}
